app.controller('cUser', ['$interval','$scope','sLogin', '$rootScope', function($interval, $scope, sLogin, $rootScope) {
	$scope.username = "";
	$scope.password = "";
	$scope.firstName = sLogin.firstName;
	$scope.lastName = sLogin.lastName;
	
	$scope.login = function login(usr, psw) {
		sLogin.login(usr, psw);
		$scope.password = "";
		
	}
	$scope.logout = function logout() {
		sLogin.logout();
		$scope.username = "";
		$scope.password = "";
		$scope.firstName = "";
		$scope.lastName = "";
	}
	$scope.$on('sLogin', function(event) {
		$scope.firstName = sLogin.firstName;
		$scope.lastName = sLogin.lastName;
	});
	
	return {
		firstName: $scope.firstName,
		lastName: $scope.lastName,
		userName: $scope.userName
	};
}]);